//
//  EmailViewController.m
//  RACExample
//
//  Created by 山刘 on 2019/8/29.
//  Copyright © 2019 山刘. All rights reserved.
//

#import "EmailViewController.h"
#import "EmailViewModel.h"

@interface EmailViewController ()
@property (weak, nonatomic) IBOutlet UITextField *inputView;
@property (weak, nonatomic) IBOutlet UIButton *button;
@property (weak, nonatomic) IBOutlet UILabel *label;
@property(nonatomic, strong) EmailViewModel *viewModel;
@end

@implementation EmailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    RAC(self.viewModel,email) = self.inputView.rac_textSignal;
    self.button.rac_command = self.viewModel.subscribeCommand;
    RAC(self.label,text) = RACObserve(self.viewModel, statusMessage);
    
}
- (IBAction)subscribeClick:(id)sender {
}
-(EmailViewModel *)viewModel{
    if (!_viewModel) {
        _viewModel = [EmailViewModel new];
    }
    return _viewModel;
}
@end
